import request from '@/utils/request'

// 创建不良代码定义
export function createBadReason(data) {
  return request({
    url: '/quality/bad-reason/create',
    method: 'post',
    data: data
  })
}

// 更新不良代码定义
export function updateBadReason(data) {
  return request({
    url: '/quality/bad-reason/update',
    method: 'put',
    data: data
  })
}

// 删除不良代码定义
export function deleteBadReason(id) {
  return request({
    url: '/quality/bad-reason/delete?id=' + id,
    method: 'delete'
  })
}

/** 批量删除不良代码定义 */
export function deleteBadReasonList(ids) {
  return request({
    url: `/quality/bad-reason/delete-list?ids=${ids.join(',')}`,
    method: 'delete'
  })
}

// 获得不良代码定义
export function getBadReason(id) {
  return request({
    url: '/quality/bad-reason/get?id=' + id,
    method: 'get'
  })
}

// 获得不良代码定义分页
export function getBadReasonPage(params) {
  return request({
    url: '/quality/bad-reason/page',
    method: 'get',
    params
  })
}
// 导出不良代码定义 Excel
export function exportBadReasonExcel(params) {
  return request({
    url: '/quality/bad-reason/export-excel',
    method: 'get',
    params,
    responseType: 'blob'
  })
}